<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <% 
		String path = request.getContextPath();    
    %>
<html lang="en">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="path" value="${pageContext.request.contextPath}" ></c:set>
<script type="text/javascript" src="${path }/js/jquery-3.6.0.min.js"></script>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>帖子内容详情页面</title>

    <link rel="icon" type="image/png" href="<%= path %>/assets/images/favicon-32x32.png">

    <link rel="stylesheet" href="<%= path %>/assets/main/css/fonts.css">
    <link rel="stylesheet" href="<%= path %>/assets/main/css/style.css">
</head>

<body>
    <div id="main-wrapper" class="show">
        <div class="nav-header">
            <div class="brand-logo">
                <a href="index.html"><img class="brand-title" src="<%= path %>/assets/images/logo.png" alt=""></a>
            </div>
        </div>
        <aside class="left-panel nicescroll-box">
            
           <nav class="navigation">
                <ul class="list-unstyled main-menu">
                    <li class="has-submenu">
                        <a href="${path }/MyCollectionController?action=getMyCollection">
                            <i class="fas fa-th-large"></i>
                            <span class="nav-label">我的收藏</span>
                        </a>
                    </li>
                    <li class="has-submenu">
                        <a href="${path }/PostController?action=show">
                            <i class="fas fa-calendar-plus"></i>
                            <span class="nav-label">我的发布</span>
                        </a>
                    </li>
                    <li class="has-submenu">
                        <a href="${path }/UpdatePasswordController?action=changeuserpass">
                            <i class="fas fa-chart-pie"></i>
                            <span class="nav-label">修改密码</span>
                        </a>
                    </li>
                    <li class="has-submenu">
                        <a href="${path}/UpdateUserinfoCenterController?action=UpdateUserinfoCenterById">
                            <i class="fas fa-cog"></i>
                            修改个人信息
                        </a>
                    </li>
                    <li class="has-submenu">
                          <a href="${path}/PostNumberLikesController?action=postNumberLikes">
                            <i class="fas fa-cog"></i>
          	获赞               
                        </a>
                    </li>
                     <li class="has-submenu">
                          <a href="${path}/CommentReplyController?action=findAll">
                            <i class="fas fa-cog"></i>
          	我的帖子                
                        </a>
                    </li>
                </ul>
            </nav>
            
            <div class="sidebar-widgets">
                <div class="top-sidebar box-shadow mx-25 m-b-30 p-b-20 text-center">
                <img src="<%= path %>/assets/images/appointement.svg" class="side-img" alt="img">
                </div>
                <div class="copyright text-center">
                    <p class="mb-0"> 中国航天</p>
                    <p class="mb-0"> © 2021 </p>
                </div>
            </div>
        </aside>




       <jsp:include page="/inc/signter.jsp"></jsp:include>


        <div class="content-body">
             <div class="warper container-fluid">
                <div class="row page-titles mx-0">
                    <div class="col-lg-12 p-md-0">
                        <h4 class="text-primary"><%-- 帖子:${post.title } --%></h4>
                    </div>
                </div>
                <div class="new-patients main_container">
                    <div class="row">
                        <div class="col-sm-6 col-xl-3 col-lg-6">
                       
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12">
                            <div class="card shadow">
                                <div class="card-header">
                                    <h4 class="card-title">帖子的内容</h4>
                                </div>
                                <div class="card-body">
                                    <div class="table-responsive">
                                        <h3  style="text-align:center;">${post.title}</h3>
         								 <h5 style="text-align:center;font-weight:lighter;">发布时间:${post.pubTime}</h3>
         								 <h4><!-- 发布内容: --></h4>
         								 ${post.content} 
                                        
                                    </div>
                                   
                                   <div>
                                  
                                 
                                    
                                </div>
                            </div>
                        </div>
                    </div>


					<div class="row">
						<div class="col-md-12">
							<div class="card shadow">
								<div class="card-header">
									<h6 class="card-title">评论</h6>
								</div>
								<div class="card-body">

									<div>
										<c:forEach items="${comments}" var="comments">
											<table>
									
												<tr>
													<td><h6>用户:${comments.userinfo.username }</h6></td>
												<tr>
												<tr>
													<td><h6>评论:${comments.content }</h6></td>

												</tr>
												<tr>

													<td><button class="change" pid=${comments.id } <%-- name=${comments.userinfo.username } --%>>查看回复</button></td> 
												</tr>
												
											</table>
											<div id="ment"  style="border:1px solid gray;width:260px;height:200px;display:none">
											
											</div>
											<!-- <textarea  rows="5" cols="20">  </textarea>  -->
										</c:forEach>
									</div>

								</div>
							</div>
						</div>
					</div>
				




				</div>
            </div>
                           
                       
              
        </div>
        
        
        <div class="footer">
            <div class="copyright">
                <p class="mb-0">Copyright ©&中国航天  &amp;2021
                </p>
            </div>
        </div>
    </div>

   
    <script src="<%=path%>/assets/plugins/popper/popper.min.js"></script>
    <script src="<%=path%>/assets/plugins/bootstrap/js/bootstrap.js"></script>
    <script src="<%=path%>/assets/plugins/moment/moment.min.js"></script>
    <script src="<%=path%>/assets/plugins/daterangepicker/daterangepicker.min.js"></script>
    <script src="<%=path%>/assets/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="<%=path%>/assets/js/init-tdatatable.js"></script>
    <script src="<%= path %>/assets/plugins/chart/chart/Chart.min.js"></script>
    <script src="<%= path %>/assets/js/charts-custom.js"></script>
    <script src="<%= path %>/assets/js/toggleFullScreen.js"></script>
    <script src="<%= path %>/assets/js/main.js"></script>

</body>

</html>

<script type="text/javascript">
  $(function(){
	  $(".change").click(function(){
		  $(this).parent().parent().parent().parent().next().css("display","block");
		  var pid=$(this).attr("pid");
		 /*  var name=$(this).attr("name"); */
		 
		
		  $.ajax({
			    url:"${path}/CommentReplyController",
			    data:{action:"replyToPost",pid:pid,name:name},
			    success:function(mes){
			    	 $(this).parent().parent().parent().parent().next().html(mes);
			    }.bind(this)
			     })
	  })
	  
	   $(".change").mouseout(function(){
		  $(this).parent().parent().parent().parent().next().css("display","none");
	  }); 
	  
	  
	   
  })
</script>